package com.wuwu.springcloud.service;

import com.wuwu.springcloud.pojo.Dept;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
@Component
public class DeptClientServiceImpot implements FallbackFactory {
    @Override
    public Object create(Throwable throwable) {
        return new DeptClientService() {
            @Override
            public boolean addDept(Dept dept) {
                return false;
            }

            @Override
            public Dept queryBuId(Long id) {
                return new Dept()
                        .setDeptno(id)
                        .setDname("没有对应信息")
                        .setDb_source("没有数据");
            }

            @Override
            public List<Dept> queryList() {
              List<Dept> depts = new ArrayList<>();
              depts.get(0).setDname("没有对应信息").setDb_source("没有数据");
                return depts;
            }
        };
    }
}
